#ifndef THREAD_H_
#define THREAD_H_

#include <tr1/functional>
#include <pthread.h>

typedef std::tr1::function<void (void)> ThreadFunction;

class Thread {
  public:
    // Initialise thread.
    explicit Thread(ThreadFunction f);
    // Kill thread.
    ~Thread();
    // Disable: copy constructor, assignment operator.

    void join();
    void detach();
    void abort();

  private:
    // Thread identifier.
    pthread_t thread_;
    // Function to run.
    ThreadFunction f_;

    Thread(const Thread&);
    Thread& operator=(const Thread&);
};

#endif
